import path2var from '@helpers/path2var';

const getters = {};

const requireModules = require.context('@store/modules', true, /.js$/);
requireModules.keys().forEach((key) => {
    const { state: moduleState = {} } = requireModules(key).default;
    Object.keys(moduleState).forEach((name) => {
        getters[name] = function (state) {
            return state[path2var(key)][name];
        };
    });
});

export default getters;
